package HomeWork.Chapter03;

import java.util.Scanner;

/**
 * Enjoy programming!!!
 * Time: 2021/11/3 -  19:37
 */

public class Factorial {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int sum = 0;
        int f = 1;
        int i = 0;

        while (sum < n) {
            i++;
            f *= i;
            sum += f;
            System.out.println(sum + "\t" + i);
        }
        System.out.println(i - 1);
    }
}



